import pandas as pd
import json


def json_to_excel(json_file_path, excel_file_path):
    # 读取JSON文件
    with open(json_file_path, 'r', encoding='utf-8') as file:
        data = json.load(file)

    # 将JSON数据转换为DataFrame
    df = pd.DataFrame(data)

    # 将DataFrame保存为Excel文件
    df.to_excel(excel_file_path, index=False, engine='openpyxl')


# 使用示例
json_file_path = '../Coze-knowledge/output.json'
excel_file_path = '../Coze-knowledge/output.xlsx'
json_to_excel(json_file_path, excel_file_path)